<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script type="text/javascript">
    function GetRTime(){
        var EndTime= new Date('2018/09/25 14:00:00');  //结束时间
        var StartTime= new Date('2018/09/23 00:00:00');  //开始时间
        var NowTime = new Date();
        var t =EndTime.getTime() - NowTime.getTime();
        var start =StartTime.getTime() - NowTime.getTime();
        var d=0;
        var h=0;
        var m=0;
        var s=0;
        var Sd=0;
        var Sh=0;
        var Sm=0;
        var Ss=0;
        if(t>=0){
            d=Math.floor(t/1000/60/60/24);
            h=Math.floor(t/1000/60/60%24);
            m=Math.floor(t/1000/60%60);
            s=Math.floor(t/1000%60);
        }
        if(start>=0){
            Sd=Math.floor(start/1000/60/60/24);
            Sh=Math.floor(start/1000/60/60%24);
            Sm=Math.floor(start/1000/60%60);
            Ss=Math.floor(start/1000%60);
        }
        if(start <0 && t>0){
//            开抢后提示
            //document.getElementById("time_txt").innerHTML="距离抢购结束还有 ";
            //$(".day").hide();
            document.getElementById("t_h").innerHTML = h ;
            document.getElementById("t_m").innerHTML = m ;
            document.getElementById("t_s").innerHTML = s ;
        }else if(start>0){
//            未开抢提示
            document.getElementById("t_d").innerHTML = Sd ;
            document.getElementById("t_h").innerHTML = Sh ;
            document.getElementById("t_m").innerHTML = Sm ;
            document.getElementById("t_s").innerHTML = Ss ;
        }
    }
    setInterval(GetRTime,1000);

</script>
<body>
    <span id="t_d">00</span>天
    <span id="t_h">00</span>:
    <span id="t_m">00</span>:
    <span id="t_s">00</span>
</body>

</html>